<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <div id="abc" class="box" age="18"></div>
  <script>

    var boxEl = document.querySelector("#abc")

    // 所有的attr都支持的操作
    console.log(boxEl.hasAttribute("age"))
    console.log(boxEl.getAttribute("age"))
    console.log(boxEl.attributes)
  </script>
</body>
</html>